package org.ibase4j.thired;

import org.apache.shiro.SecurityUtils;
import org.ibase4j.system.model.SysUser;
import org.ibase4j.system.service.SysAuthorizeService;
import org.ibase4j.system.service.SysUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import top.ibase4j.core.base.BaseController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 登录验证
 * 
 * @author douzoo
 */
@Controller
//@RequestMapping(value = "web")
public class PageIndexController extends BaseController<SysUser, SysUserService>
{
    @Resource
    private SysAuthorizeService sysAuthorizeService;

    @GetMapping("/index")
    public String index(HttpServletRequest request, HttpServletResponse response)
    {
        System.out.println("index页面");
        return UiThemeConstants.THEME + "index";
    }

//    @GetMapping("/login")
//    public String login(HttpServletRequest request, HttpServletResponse response)
//    {
//        System.out.println("get登录页面");
//        return UiThemeConstants.THEME + "login";
//    }

    @GetMapping("/include")
    public String include() { return UiThemeConstants.THEME + "include"; }

//    @GetMapping("/view/modifyHead")
//    public String modifyHead() { return UiThemeConstants.THEME + "modifyHead"; }
//
//    @GetMapping("/view/common/header")
//    public String header() { return UiThemeConstants.THEME + "common/header"; }
//    @GetMapping("/view/common/menu")
//    public String menu() { return UiThemeConstants.THEME + "common/menu"; }

//    @GetMapping("/{modelName}/{viewName}")
//    public String view(@PathVariable("modelName") String modelName,@PathVariable("viewName") String viewName)
//    {
//        System.out.println("页面");
//        return UiThemeConstants.THEME + "/" + modelName + "/" + viewName;
//    }

//    @GetMapping("/logout")
//    public String logout()
//    {
//        SecurityUtils.getSubject().logout();
//        return "login";
//    }

    @GetMapping("/unauth")
    public String unauth()
    {
        return "/error/unauth";
    }
}
